<script setup>
import moment from 'moment'
import { computed, inject, onBeforeUnmount, onMounted, ref, watch } from 'vue'

import { getCheckPointList } from '@/api/manager/inspectionManage/checkPointManage'
import { getPlanList } from '@/api/manager/inspectionManage/planManage'
import DrawEcharts from '@/components/draw-echarts.vue'
import { useDict } from '@/hooks/useDict'
import Card from '@/views/new-screen/components/card.vue'
import {
  getScreenDangerRank,
  getScreenParkRank,
} from '@/api/screen/home/index.js'
import { ElMessage } from 'element-plus'

const mapId = inject('mapId')

const { dict } = useDict(['inspection_status', 'inspection_inspection_type'])

defineOptions({
  name: 'Right',
})

defineProps({
  isExpanded: Boolean,
})

let diff = [
  { name: '蔡家园区', value: 50, unit: '分' },
  { name: '歇马园区', value: 90, unit: '分' },
  { name: '三花石园区', value: 80, unit: '分' },
  { name: '澄江园区', value: 70, unit: '分' },
  { name: '东阳园区', value: 60, unit: '分' },
  { name: '南岸园区', value: 85, unit: '分' },
  { name: '龙凤园区', value: 78, unit: '分' },
  { name: '三胜园区', value: 68, unit: '分' },
  { name: '水土园区', value: 78, unit: '分' },
  // { name: 'XX园区', value: 68, unit: '分' },
]

let typeSelect = ref('0')
let dateSelect = ref('0')

const areaOptions = {
  backgroundColor: 'transparent',
  tooltip: {
    show: true,
    trigger: 'item',
    padding: [8, 15],
    backgroundColor: 'rgba(12, 51, 115,0.8)',
    borderColor: 'rgba(3, 11, 44, 0.5)',
    textStyle: {
      color: 'rgba(255, 255, 255, 1)',
    },
  },
  legend: { show: false },
  grid: { left: '22%', right: '12%', top: '5%', bottom: '3%' },
  xAxis: [
    {
      splitLine: { show: false },
      type: 'value',
      show: false,
      axisLabel: {
        fontSize: 14,
      },
      axisLine: {
        //x轴坐标轴，false为隐藏，true为显示
        show: false,
      },
    },
  ],
  yAxis: [
    {
      show: true,
      splitLine: { show: false },
      axisLine: { show: false },
      type: 'category',
      axisTick: { show: false },
      inverse: true,
      axisLabel: { show: false },
    },
    {
      type: 'category',
      inverse: true,
      axisTick: 'none',
      axisLine: 'none',
      show: true,
      axisLabel: {
        color: '#fff',
        fontSize: 14,
        formatter: function (value, index) {
          return value + diff[index].unit
        },
      },
      data: diff,
    },
  ],
  series: [
    {
      show: true,
      name: '',
      type: 'bar',
      data: diff,
      barWidth: 5, // 柱子宽度
      showBackground: true,
      label: {
        show: true,
        width: 200,
        offset: [0, 0],
        color: '#93B5C9',
        fontSize: 12,
        fontWeight: 500,
        position: 'left',
        formatter: function (params) {
          return params.data.name
        },
      },
      itemStyle: {
        show: true,
        borderRadius: [10, 10, 10, 10],
        color: {
          type: 'linear',
          colorStops: [
            { offset: 1, color: 'rgba(35, 176, 255, 1)' },
            { offset: 0, color: 'rgba(35, 176, 255, 0.1)' },
          ],
        },
      },
      emphasis: { disabled: true },
    },
    {
      name: '',
      type: 'scatter',
      emphasis: { scale: false },
      symbol: 'rect',
      symbolSize: [3, 9], // 进度条白点
      itemStyle: {
        show: true,
        color: '#FFF',
        shadowColor: 'rgba(255, 255, 255, 0.5)',
        shadowBlur: 5,
        borderWidth: 1,
        opacity: 1,
      },
      z: 2,
      data: diff,
      animationDelay: 500,
    },
  ],
}

let option = ref({})

let checkTask3DOptions = ref('')

let dateValue = ref('')

const checkTaskOptions = ref([
  {
    name: '已完成', //名称
    value: 0, //值
    percent: 0,
    itemStyle: {
      //颜色
      color: '#50FEA3',
    },
  },
  {
    name: '未完成',
    value: 0,
    percent: 0,
    itemStyle: {
      color: '#36D5F0',
    },
  },
  {
    name: '已超时',
    value: 0,
    percent: 0,
    itemStyle: {
      color: '#FAB54F',
    },
  },
])

let checkPoint3DOptions = ref('')

const checkPointOptions = ref([
  {
    name: '检查正常', //名称
    value: 0, //值
    percent: 0,
    itemStyle: {
      //颜色
      color: '#43A7FF',
    },
  },
  {
    name: '检查未完成',
    value: 0,
    percent: 0,
    itemStyle: {
      color: '#FF9668',
    },
  },
  {
    name: '检查异常',
    value: 0,
    percent: 0,
    itemStyle: {
      color: '#FF6059',
    },
  },
])

/**
 * 获取巡检统计数据
 */
const fetchInspectionData = () => {
  const params = {
    pageIndex: 1,
    pageSize: 999,
    typeId: dateSelect.value,
  }
  getPlanList(params).then((res) => {
    if (res.success) {
      // 巡检计划数据处理
      checkTaskOptions.value[0].value = res.data.list.filter(
        (item) => item.status === '2',
      ).length
      checkTaskOptions.value[1].value = res.data.list.filter(
        (item) => item.status === '1',
      ).length
      checkTaskOptions.value[2].value = res.data.list.filter(
        (item) => item.status === '-2',
      ).length
      checkTaskOptions.value[0].percent = checkTaskCount.value
        ? Number(
            (
              (checkTaskOptions.value[0].value / checkTaskCount.value) *
              100
            ).toFixed(0),
          )
        : 0
      checkTaskOptions.value[1].percent = checkTaskCount.value
        ? Number(
            (
              (checkTaskOptions.value[1].value / checkTaskCount.value) *
              100
            ).toFixed(0),
          )
        : 0
      checkTaskOptions.value[2].percent = checkTaskCount.value
        ? Number(
            (
              (checkTaskOptions.value[2].value / checkTaskCount.value) *
              100
            ).toFixed(0),
          )
        : 0
      checkTask3DOptions.value = getPie3D(checkTaskOptions.value, 0.95)
    }
  })
}

/**
 * 获取检查点数据
 */
const fetchCheckPointData = () => {
  const params = {
    pageIndex: 1,
    pageSize: 999,
    typeId: dateSelect.value,
  }
  getCheckPointList(params).then((res) => {
    if (res.success) {
      // 检查点数据处理
      // 检查点暂时没有状态，所以只给第一个状态的数据赋值
      checkPointOptions.value[0].value = res.data.count
      checkPointOptions.value[0].percent = 100
      checkPoint3DOptions.value = getPie3D(checkPointOptions.value, 0.95)
    }
  })
}

const getPie3D = (pieData, internalDiameterRatio) => {
  let series = []
  let sumValue = 0
  let startValue = 0
  let endValue = 0
  let legendData = []
  let legendBfb = []
  let k = 1 - internalDiameterRatio
  pieData.sort((a, b) => {
    return b.value - a.value
  })
  // 为每一个饼图数据，生成一个 series-surface(参数曲面) 配置
  for (let i = 0; i < pieData.length; i++) {
    sumValue += pieData[i].value
    let seriesItem = {
      //系统名称
      name:
        typeof pieData[i].name === 'undefined' ? `series${i}` : pieData[i].name,
      type: 'surface',
      //是否为参数曲面（是）
      parametric: true,
      //曲面图网格线（否）上面一根一根的
      wireframe: {
        show: false,
      },
      pieData: pieData[i],
      pieStatus: {
        selected: false,
        hovered: false,
        k: k,
      },
      //设置饼图在容器中的位置(目前没发现啥用)
      // center: ['80%', '100%'],
      radius: ['40%', '80%'],
    }

    //曲面的颜色、不透明度等样式。
    if (typeof pieData[i].itemStyle != 'undefined') {
      let itemStyle = {}
      typeof pieData[i].itemStyle.color != 'undefined'
        ? (itemStyle.color = pieData[i].itemStyle.color)
        : null
      typeof pieData[i].itemStyle.opacity != 'undefined'
        ? (itemStyle.opacity = pieData[i].itemStyle.opacity)
        : null
      seriesItem.itemStyle = itemStyle
      // seriesItem.radius = ['70%', '90%']
    }
    series.push(seriesItem)
  }

  // 使用上一次遍历时，计算出的数据和 sumValue，调用 getParametricEquation 函数，
  // 向每个 series-surface 传入不同的参数方程 series-surface.parametricEquation，也就是实现每一个扇形。
  legendData = []
  legendBfb = []
  for (let i = 0; i < series.length; i++) {
    endValue = startValue + series[i].pieData.value
    series[i].pieData.startRatio = startValue / sumValue
    series[i].pieData.endRatio = endValue / sumValue
    series[i].parametricEquation = getParametricEquation(
      series[i].pieData.startRatio,
      series[i].pieData.endRatio,
      false,
      false,
      k,
      series[i].pieData.value,
    )
    startValue = endValue
    let bfb = fomatFloat(series[i].pieData.value / sumValue, 4)
    legendData.push({
      name: series[i].name,
      value: bfb,
    })
    legendBfb.push({
      name: series[i].name,
      value: bfb,
    })
  }

  //(第二个参数可以设置你这个环形的高低程度)
  let boxHeight = getHeight3D(series, 10) //通过传参设定3d饼/环的高度
  // 准备待返回的配置项，把准备好的 legendData、series 传入。
  let option = {
    backgroundColor: 'transparent',
    //移动上去提示的文本内容(我没来得及改 你们可以根据需求改)
    tooltip: {
      formatter: (params) => {
        if (
          params.seriesName !== 'mouseoutSeries' &&
          params.seriesName !== 'pie2d'
        ) {
          let bfb = (
            (option.series[params.seriesIndex].pieData.endRatio -
              option.series[params.seriesIndex].pieData.startRatio) *
            100
          ).toFixed(2)
          return (
            `${params.seriesName}<br/>` +
            `<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${params.color};"></span>` +
            `${bfb}`
          )
        }
      },
    },
    labelLine: {
      show: true,
      lineStyle: {
        color: '#7BC0CB',
      },
    },
    label: {
      show: true,
      position: 'outside',
      formatter: '{b} \n{c} {d}%',
    },
    //这个可以变形
    xAxis3D: {
      min: -1,
      max: 1,
    },
    yAxis3D: {
      min: -1,
      max: 1,
    },
    zAxis3D: {
      min: -1,
      max: 1,
    },
    //此处是修改样式的重点
    grid3D: {
      show: false,
      boxHeight: boxHeight, //圆环的高度
      //这是饼图的位置
      top: '0%',
      left: '0%',
      viewControl: {
        //3d效果可以放大、旋转等，请自己去查看官方配置
        alpha: 25, //角度(这个很重要 调节角度的)
        distance: 135, //调整视角到主体的距离，类似调整zoom(这是整体大小)
        rotateSensitivity: 0, //设置为0无法旋转
        zoomSensitivity: 0, //设置为0无法缩放
        panSensitivity: 0, //设置为0无法平移
        autoRotate: false, //自动旋转
      },
    },
    series: series,
  }
  return option
}
//获取3d丙图的最高扇区的高度
const getHeight3D = (series, height) => {
  series.sort((a, b) => {
    return b.pieData.value - a.pieData.value
  })
  return 1.5
}
// 生成扇形的曲面参数方程，用于 series-surface.parametricEquation
const getParametricEquation = (
  startRatio,
  endRatio,
  isSelected,
  isHovered,
  k,
  h,
) => {
  // 计算
  let midRatio = (startRatio + endRatio) / 2
  let startRadian = startRatio * Math.PI * 2
  let endRadian = endRatio * Math.PI * 2
  let midRadian = midRatio * Math.PI * 2
  // 如果只有一个扇形，则不实现选中效果。
  if (startRatio === 0 && endRatio === 1) {
    isSelected = false
  }
  // 通过扇形内径/外径的值，换算出辅助参数 k（默认值 1/3）
  k = typeof k !== 'undefined' ? k : 1 / 3
  // 计算选中效果分别在 x 轴、y 轴方向上的位移（未选中，则位移均为 0）
  let offsetX = isSelected ? Math.cos(midRadian) * 0.1 : 0
  let offsetY = isSelected ? Math.sin(midRadian) * 0.1 : 0
  // 计算高亮效果的放大比例（未高亮，则比例为 1）
  let hoverRate = isHovered ? 1.05 : 1
  // 返回曲面参数方程
  return {
    u: {
      min: -Math.PI,
      max: Math.PI * 3,
      step: Math.PI / 32,
    },
    v: {
      min: 0,
      max: Math.PI * 2,
      step: Math.PI / 20,
    },
    x: function (u, v) {
      if (u < startRadian) {
        return (
          offsetX + Math.cos(startRadian) * (1 + Math.cos(v) * k) * hoverRate
        )
      }
      if (u > endRadian) {
        return offsetX + Math.cos(endRadian) * (1 + Math.cos(v) * k) * hoverRate
      }
      return offsetX + Math.cos(u) * (1 + Math.cos(v) * k) * hoverRate
    },
    y: function (u, v) {
      if (u < startRadian) {
        return (
          offsetY + Math.sin(startRadian) * (1 + Math.cos(v) * k) * hoverRate
        )
      }
      if (u > endRadian) {
        return offsetY + Math.sin(endRadian) * (1 + Math.cos(v) * k) * hoverRate
      }
      return offsetY + Math.sin(u) * (1 + Math.cos(v) * k) * hoverRate
    },
    z: function (u, v) {
      if (u < -Math.PI * 0.5) {
        return Math.sin(u)
      }
      if (u > Math.PI * 2.5) {
        return Math.sin(u) * h * 0.1
      }
      return Math.sin(v) > 0 ? 1 * h * 0.1 : -1
    },
  }
}
// 监听鼠标事件，实现饼图选中效果（单选），近似实现高亮（放大）效果。
// const bindListen = (myChart) => {
//   let that = this;
//   let selectedIndex = '';
//   let hoveredIndex = '';
//   // 监听点击事件，实现选中效果（单选）
//   myChart.on('click', function (params) {
//     // 从 option.series 中读取重新渲染扇形所需的参数，将是否选中取反。
//     let isSelected = !option.value.series[params.seriesIndex].pieStatus.selected;
//     let isHovered = option.value.series[params.seriesIndex].pieStatus.hovered;
//     let k = option.value.series[params.seriesIndex].pieStatus.k;
//     let startRatio = option.value.series[params.seriesIndex].pieData.startRatio;
//     let endRatio = option.value.series[params.seriesIndex].pieData.endRatio;
//     // 如果之前选中过其他扇形，将其取消选中（对 option 更新）
//     if (selectedIndex !== '' && selectedIndex !== params.seriesIndex) {
//       option.value.series[selectedIndex].parametricEquation = getParametricEquation(option.value.series[
//         selectedIndex].pieData
//         .startRatio, option.value.series[selectedIndex].pieData.endRatio, false, false, k, option.value.series[
//           selectedIndex].pieData
//         .value);
//       option.value.series[selectedIndex].pieStatus.selected = false;
//     }
//     // 对当前点击的扇形，执行选中/取消选中操作（对 option 更新）
//     option.value.series[params.seriesIndex].parametricEquation = getParametricEquation(startRatio, endRatio,
//       isSelected,
//       isHovered, k, option.value.series[params.seriesIndex].pieData.value);
//     option.value.series[params.seriesIndex].pieStatus.selected = isSelected;
//     // 如果本次是选中操作，记录上次选中的扇形对应的系列号 seriesIndex
//     isSelected ? selectedIndex = params.seriesIndex : null;
//     // 使用更新后的 option，渲染图表
//     myChart.setOption(option.value);
//   });
//   // 监听 mouseover，近似实现高亮（放大）效果
//   myChart.on('mouseover', function (params) {
//     // 准备重新渲染扇形所需的参数
//     let isSelected;
//     let isHovered;
//     let startRatio;
//     let endRatio;
//     let k;
//     // 如果触发 mouseover 的扇形当前已高亮，则不做操作
//     if (hoveredIndex === params.seriesIndex) {
//       return;
//       // 否则进行高亮及必要的取消高亮操作
//     } else {
//       // 如果当前有高亮的扇形，取消其高亮状态（对 option 更新）
//       if (hoveredIndex !== '') {
//         // 从 option.series 中读取重新渲染扇形所需的参数，将是否高亮设置为 false。
//         isSelected = option.value.series[hoveredIndex].pieStatus.selected;
//         isHovered = false;
//         startRatio = option.value.series[hoveredIndex].pieData.startRatio;
//         endRatio = option.value.series[hoveredIndex].pieData.endRatio;
//         k = option.value.series[hoveredIndex].pieStatus.k;
//         // 对当前点击的扇形，执行取消高亮操作（对 option 更新）
//         option.value.series[hoveredIndex].parametricEquation = that.getParametricEquation(startRatio, endRatio,
//           isSelected,
//           isHovered, k, option.value.series[hoveredIndex].pieData.value);
//         option.value.series[hoveredIndex].pieStatus.hovered = isHovered;
//         // 将此前记录的上次选中的扇形对应的系列号 seriesIndex 清空
//         hoveredIndex = '';
//       }
//       // 如果触发 mouseover 的扇形不是透明圆环，将其高亮（对 option 更新）
//       if (params.seriesName !== 'mouseoutSeries' && params.seriesName !== 'pie2d') {
//         // 从 option.series 中读取重新渲染扇形所需的参数，将是否高亮设置为 true。
//         isSelected = option.value.series[params.seriesIndex].pieStatus.selected;
//         isHovered = true;
//         startRatio = option.value.series[params.seriesIndex].pieData.startRatio;
//         endRatio = option.value.series[params.seriesIndex].pieData.endRatio;
//         k = option.value.series[params.seriesIndex].pieStatus.k;
//         // 对当前点击的扇形，执行高亮操作（对 option 更新）
//         option.value.series[params.seriesIndex].parametricEquation = that.getParametricEquation(startRatio, endRatio,
//           isSelected, isHovered, k, option.value.series[params.seriesIndex].pieData.value + 5);
//         option.value.series[params.seriesIndex].pieStatus.hovered = isHovered;
//         // 记录上次高亮的扇形对应的系列号 seriesIndex
//         hoveredIndex = params.seriesIndex;
//       }
//       // 使用更新后的 option，渲染图表
//       myChart.setOption(option.value);
//     }
//   });
//   // 修正取消高亮失败的 bug
//   myChart.on('globalout', function () {
//     // 准备重新渲染扇形所需的参数
//     let isSelected;
//     let isHovered;
//     let startRatio;
//     let endRatio;
//     let k;
//     if (hoveredIndex !== '') {
//       // 从 option.series 中读取重新渲染扇形所需的参数，将是否高亮设置为 true。
//       isSelected = option.value.series[hoveredIndex].pieStatus.selected;
//       isHovered = false;
//       k = option.value.series[hoveredIndex].pieStatus.k;
//       startRatio = option.value.series[hoveredIndex].pieData.startRatio;
//       endRatio = option.value.series[hoveredIndex].pieData.endRatio;
//       // 对当前点击的扇形，执行取消高亮操作（对 option 更新）
//       option.value.series[hoveredIndex].parametricEquation = that.getParametricEquation(startRatio, endRatio,
//         isSelected,
//         isHovered, k, option.value.series[hoveredIndex].pieData.value);
//       option.value.series[hoveredIndex].pieStatus.hovered = isHovered;
//       // 将此前记录的上次选中的扇形对应的系列号 seriesIndex 清空
//       hoveredIndex = '';
//     }
//     // 使用更新后的 option，渲染图表
//     myChart.setOption(option.value);
//   });
// }
//这是一个自定义计算的方法
const fomatFloat = (num, n) => {
  var f = parseFloat(num)
  if (isNaN(f)) {
    return false
  }
  f = Math.round(num * Math.pow(10, n)) / Math.pow(10, n) // n 幂
  var s = f.toString()
  var rs = s.indexOf('.')
  //判定如果是整数，增加小数点再补0
  if (rs < 0) {
    rs = s.length
    s += '.'
  }
  while (s.length <= rs + n) {
    s += '0'
  }
  return s
}
onMounted(async () => {
  checkTask3DOptions.value = getPie3D(checkTaskOptions.value, 0.95)
  checkPoint3DOptions.value = getPie3D(checkPointOptions.value, 0.95)
  dateValue.value = new Date()
  // const { map, layerManager } = await getHelper(mapId)
  // _viewer = map
  // measure = new Cesium.Measure(map)
  // _layerManager = layerManager
  // areaPoint.value.map(item=>{
  // _layerManager.addLayer(areaPoint.value)
  // })
  getParkCompareChartData(typeSelect.value)
})
onBeforeUnmount(() => {
  // _layerManager.removeLayer(areaPoint.value)
})

/**
 * 任务总数
 */
const checkTaskCount = computed(() => {
  return checkTaskOptions.value.reduce((sum, item) => {
    return sum + item.value
  }, 0)
})

/**
 * 检查点数量
 */
const checkPointCount = computed(() => {
  return checkPointOptions.value.reduce((sum, item) => {
    return sum + item.value
  }, 0)
})

watch(
  () => [dateValue.value, dateSelect.value],
  ([date, type]) => {
    console.log('date change', moment(date).format('YYYY-MM-DD'))
    fetchInspectionData()
    fetchCheckPointData()
  },
)

const rankCompareChartRef = ref(null)

const getParkCompareChartData = async (select) => {
  try {
    let promise = new Promise((resolve, reject) => {
      resolve({ success: true, data: [] })
    })
    let valueKey = 'value'
    let unit = '分'
    if (select == '0') {
      promise = getScreenParkRank()
      valueKey = 'score'
    } else if (select == '1') {
      promise = getScreenDangerRank()
      valueKey = 'dangercount'
      unit = '个'
    }
    const res = await promise
    if (res.success) {
      // console.log(res.data)
      const data =
        res.data?.map((item) => {
          return {
            name: item.name,
            value: item[valueKey] || 0,
            unit,
          }
        }) || []
      areaOptions.yAxis[1].data = data
      areaOptions.yAxis[1].axisLabel.formatter = function (value, index) {
        return value + data[index].unit
      }
      areaOptions.series[0].data = data
      areaOptions.series[1].data = data
      rankCompareChartRef.value?.updateOption(areaOptions)
    } else {
      ElMessage.error(res.message)
    }
  } catch (e) {
    console.log(e)
  }
}

const handleChangeParkCompareType = (select) => {
  typeSelect.value = select
  getParkCompareChartData(select)
}
</script>

<template>
  <div :class="['right', isExpanded ? 'active' : '']">
    <card name="园区分析" class="area-analysis">
      <template #title>
        <i class="title-icon"></i>
      </template>
      <div class="area-title">
        <div class="area-title-left">
          <div
            class="area-title-left-name"
            :class="typeSelect == '0' ? 'is-active' : ''"
            @click="handleChangeParkCompareType('0')"
          >
            园区评分排名
          </div>
          <div
            class="area-title-left-name"
            :class="typeSelect == '1' ? 'is-active' : ''"
            @click="handleChangeParkCompareType('1')"
          >
            危房统计
          </div>
          <!--          <div-->
          <!--            class="area-title-left-name"-->
          <!--            :class="typeSelect == '2' ? 'is-active' : ''"-->
          <!--            @click="handleChangeParkCompareType('2')"-->
          <!--          >-->
          <!--            边坡监测点统计-->
          <!--          </div>-->
        </div>
      </div>
      <div class="area-chart">
        <draw-echarts
          ref="rankCompareChartRef"
          width="400"
          height="400"
          :options="areaOptions"
        ></draw-echarts>
      </div>
    </card>
    <card name="巡检统计" class="inspection-statistics">
      <template #title>
        <i class="title-icon"></i>
      </template>
      <template #right>
        <div class="area-title-right">
          <img src="../../../../assets/imgs/ic_rq.png" />
          <el-date-picker v-model="dateValue" type="date" :size="'small'" />
        </div>
      </template>
      <div class="area-title" style="margin-top: 30px">
        <div class="area-title-left" style="justify-content: flex-start">
          <!-- <div class="area-title-left-names"> -->
          <div
            class="area-title-left-name"
            :class="dateSelect == '0' ? 'is-active' : ''"
            @click="dateSelect = '0'"
          >
            日检查
          </div>
          <div
            class="area-title-left-name"
            :class="dateSelect == '1' ? 'is-active' : ''"
            @click="dateSelect = '1'"
          >
            周检查
          </div>
          <div
            class="area-title-left-name"
            :class="dateSelect == '2' ? 'is-active' : ''"
            @click="dateSelect = '2'"
          >
            月检查
          </div>
          <div
            class="area-title-left-name"
            :class="dateSelect == '3' ? 'is-active' : ''"
            @click="dateSelect = '3'"
          >
            专项检查
          </div>
          <!-- </div> -->
        </div>
      </div>
      <div class="inspection">
        <div class="inspection-left">
          <div class="inspection-left-top">
            <div class="total-num">
              <div class="value">
                <span>{{ checkTaskCount }}</span
                >个
              </div>
              <div class="name">任务总数</div>
            </div>
            <draw-echarts
              width="200"
              height="195"
              v-if="checkTask3DOptions"
              :options="checkTask3DOptions"
            ></draw-echarts>
          </div>
          <div class="inspection-left-bottom"></div>
        </div>
        <div class="inspection-right">
          <div
            class="inspection-right-line"
            v-for="(item, index) in checkTaskOptions"
            :key="index"
            :style="{ color: item.itemStyle.color }"
          >
            <div
              class="left-icon"
              :style="{ backgroundColor: item.itemStyle.color }"
            ></div>
            <div class="name">{{ item.name }}</div>
            <div class="value">{{ item.value }}个</div>
            <div class="percent">{{ item.percent }}%</div>
          </div>
        </div>
      </div>
      <div class="inspection">
        <div class="inspection-left">
          <div class="inspection-left-top">
            <div class="total-num">
              <div class="value">
                <span>{{ checkPointCount }}</span
                >个
              </div>
              <div class="name">检查点数量</div>
            </div>
            <draw-echarts
              width="200"
              height="195"
              v-if="checkPoint3DOptions"
              :options="checkPoint3DOptions"
            ></draw-echarts>
          </div>
          <div class="inspection-left-bottom"></div>
        </div>
        <div class="inspection-right">
          <div
            class="inspection-right-line"
            v-for="(item, index) in checkPointOptions"
            :key="index"
            :style="{ color: item.itemStyle.color }"
          >
            <div
              class="left-icon"
              :style="{ backgroundColor: item.itemStyle.color }"
            ></div>
            <div class="name">{{ item.name }}</div>
            <div class="value">{{ item.value }}个</div>
            <div class="percent">{{ item.percent }}%</div>
          </div>
        </div>
      </div>
    </card>
  </div>
</template>

<style scoped lang="scss">
.right {
  .title-icon {
    display: inline-flex;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    height: 61px;
    position: relative;
    bottom: 20px;
    // margin-top: 10px;
  }

  .area-title {
    display: flex;
    height: 21px;
    position: relative;

    &-left {
      height: 100%;
      width: 345px;
      background-size: 100% 100%;
      background-repeat: no-repeat;
      background-image: url('@/assets/imgs/tab_yq_d.png');
      margin-left: 40px;
      display: flex;
      justify-content: space-around;
      padding-left: 20px;

      &-names {
        width: 200px;
        display: flex;
        justify-content: space-around;
      }

      &-name {
        font-family: Source Han Sans SC;
        font-weight: bold;
        font-size: 16px;
        color: #00a6ff;
        background: linear-gradient(0deg, #8dc4ff 0%, #ffffff 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        cursor: pointer;
        margin-right: 10px;
      }

      .is-active {
        font-weight: bold;
        font-size: 16px;
        color: #ffffff;
        background: linear-gradient(259deg, #fff4c8 0%, #ffc152 98.9990234375%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }
    }

    &-right {
      height: 100%;
      // position: absolute;
      // right: 0;
      display: flex;
      align-items: center;
      font-family: Source Han Sans SC;
      font-weight: 500;
      font-size: 14px;
      color: #ffffff;

      img {
        height: 14px;
        width: 14px;
        margin-right: 4px;
      }

      :deep(.el-date-editor.el-input, .el-date-editor.el-input__wrapper) {
        width: 100px;
      }

      :deep(.el-date-editor) {
        .el-input__prefix {
          display: none;
        }

        .el-input__wrapper {
          background-color: transparent;
          box-shadow: none;
          padding: 0;

          .el-input__inner {
            font-family: Source Han Sans SC;
            font-weight: 500;
            font-size: 14px;
            color: #ffffff;
          }
        }
      }
    }
  }

  .inspection-statistics {
    // background-image: url('@/assets/imgs/box_sbfltj.png');
    height: 456px;

    .title-icon {
      width: 122px;
      background-image: url('@/assets/imgs/xjtj_title.png');
    }

    .inspection {
      height: 190px;
      display: flex;

      &-left {
        width: 50%;
        height: 100%;

        &-top {
          width: 100%;
          height: 100%;
          z-index: 10;
          // background-color: transparent;
          position: relative;

          .total-num {
            color: #ffffff;
            position: absolute;
            width: 80%;
            left: 10%;
            text-align: center;
            top: 40.5%;
            z-index: 100;

            .value {
              color: #b2c9df;

              span {
                color: #ffffff;
                font-size: 26px;
              }
            }
          }

          :deep(.echarts-container) {
            z-index: 10;
            // background-color: transparent;
          }
        }

        &-bottom {
          width: 100%;
          height: 50%;
          background-size: 100% 100%;
          background-repeat: no-repeat;
          background-image: url('@/assets/imgs/img_bt_d.png');
          position: relative;
          bottom: 55%;
          right: 5px;
          z-index: 0;
        }
      }

      &-right {
        width: 50%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;

        // align-items: center;
        &-line {
          display: flex;
          height: 30px;
          align-items: center;
          font-weight: 500;
          font-size: 12px;

          .left-icon {
            width: 8px;
            height: 8px;
          }

          .name {
            color: #c4eaff;
            margin-left: 20px;
            width: 60px;
          }

          .value {
            width: 40px;
            margin-left: 20px;
          }

          .percent {
            margin-left: 10px;
          }
        }
      }
    }
  }

  .area-analysis {
    // background-image: url('@/assets/imgs/box_bjsjtj.png');
    height: 458px;
    margin-bottom: var(--card-margin-bottom);

    .title-icon {
      width: 122px;
      background-image: url('@/assets/imgs/yqfx_title.png');
    }
  }
}
</style>
